package org.example.threadlocal;

import com.alibaba.ttl.TransmittableThreadLocal;

public class UserContext {
    private static final TransmittableThreadLocal<String> userContext = new TransmittableThreadLocal<>();

    public static void setUser(String username) {
        userContext.set(username);
    }

    public static String getUser() {
        return userContext.get();
    }

    public static void clear() {
        userContext.remove();
    }
}
